﻿@model LuxDiner.Model.Financial.BankModel


<div class="GeneralEdit" id="fmBank">
    <ul>
        <li>
            <label for="txtBankName">银行名称：</label>
            <input type="text" class="k-textbox" id="txtBankName" name="bankName" value="@Model.BankName" maxlength="50" pattern=".{2,}" required validationMessage="请输入银行名称" />
            <span class="k-invalid-msg" data-for="bankName"></span>
        </li>
        <li>
            <label for="txtCardNo">帐号：</label>
            <input type="text" class="k-textbox" id="txtCardNo" name="cardno" value="@Model.CardNo" maxlength="50" pattern=".{2,}" />
            <span class="k-invalid-msg" data-for="cardno"></span>
        </li>
        <li class="editButtons">
            <button id="btnSaveBank" class="k-button"><span class="k-icon k-i-tick"></span><span>确认提交</span></button>
            &nbsp;&nbsp;
            <button class="k-button" onclick="CancelGeneralEdit();"><span class="k-icon k-i-cancel"></span><span>&nbsp;返&nbsp;回</span></button>
        </li>
    </ul>
</div>

<script class="save_bank">
    
    $(function () {
        var validator = $("#fmBank").kendoValidator().data("kendoValidator");
        $("#btnSaveBank").click(function (e) {
            if (validator.validate()) {
                var values = {
                    bankID: "@Model.ID",
                    bankName: $("#txtBankName").val(),
                    cardNo: $("#txtCardNo").val(),
                };

                Whale.Remote.Operation({
                    url: "/Financial/Bank/Save",
                    parameters: values,
                    success: function (result) {
                        wndGeneralEdit.close();
                        if ($("#grid_banks").length > 0)
                            $("#grid_banks").data("kendoGrid").dataSource.read();
                    },
                    error: function (msg) {
                        wndGeneralInformation.content(msg).open();
                    }
                });
            }
            return false;
        });
    });
</script>
